<!DOCTYPE html>
<html lang="zh-CN" ng-app='he'>
	<head>
		<meta charset='utf-8' />
	
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title ng-bind='title'>考勤统计</title>
		<script type="text/javascript">
			is_local='{{local}}';
			function loadcss(cssfile) {
		        document.write('\<link rel="stylesheet" href="' + cssfile +'" type="text/css"/\>');
		    }
			function loadjs(script_filename) {
		        document.write('\<script language="javascript" type="text/javascript" src="' + script_filename + '"\>\</script\>');
		    }
		    if(!is_local){
			    static_url='/static';
		    }else{
			    static_url='../../../../static';
		    }
		    // 加载所有微信页面需要的js和css
		    loadjs(static_url+'/js/weixin_page.js')
		</script>
		<script type="text/javascript">
			var app = angular.module('he',['ngSanitize']);
			app.config(function($interpolateProvider) {
				  $interpolateProvider.startSymbol('[[');
				  $interpolateProvider.endSymbol(']]');
				});
			
			app.controller('content',function ($scope,$http) {
				// 设置body里面的变量
				$scope.show_order=['personal_leave',
									'sick_leave',
									'other_paid_leave',
									'late1',
									'late2',
									'late3',
									'late4',
									'miss_check',
									'absent']
				$scope.name_map={'day':'天',
								'hour':'小时',
								'times':'次',
								'personal_leave':'事假',
								'sick_leave':'病假',
								'other_paid_leave':'除年假外带薪假',
								'late1':'迟到（1-15分钟）',
								'late2':'迟到（16-60分钟）',
								'late3':'迟到（60-120分钟）',
								'late4':'迟到（120+分钟）',
								'miss_check':'漏打卡',
								'absent':'旷工'}
				if(is_local){
					$scope.month_report={ymonth:'2016-02',
										personal_leave:{value:1.2,unit:'day'},
										sick_leave:{value:0.5,unit:'day'},
										other_paid_leave:{value:2,unit:'day'},
										late1:{value:0,unit:'times'},
										late2:{value:0,unit:'times'},
										late3:{value:0,unit:'times'},
										late4:{value:1,unit:'times'},
										miss_check:{value:0,unit:'times'},
										absent:{value:1.5,unit:'day'},
										}
					$scope.current_user={ cn_name:'何宇林'}
				}else{
					var post_url='/attendance/ajax/';
					function init_from_server() {
							var post_data = {
									attendance_report:{},
									current_user:{}
								};  
							$http.post(post_url,post_data)
							.success(function(data, status, headers, config) { 
								if(data.attendance_report.status=='success'){
									$scope.month_report=data.attendance_report.report
									$scope.current_user=data.current_user
								}else{
									info(data.attendance_report.msg)
								}
								
							}).error(function(data, status, headers, config) {  
							    //处理错误 
							    $scope.std='有错误,返回码为:'+status;
							});
					}
					init_from_server();
				}
				$scope.test_click=function () {
					info('hello');
				}
			})
		</script>
<style>
    .listat{
        color: #ffffff;
        padding: 0 0.5em;
        overflow: hidden;
        border-bottom: 1px solid #ffffff;
    }
    .jiezhi{
    text-align: center;
    color: #1686E2;
   }

</style>
	</head>
<body ng-controller='content'>
		
<div class="container">
    <div class="row">
	    <div class="page-header">
		  	<h1>考勤统计
		  		<small>
				  	<span ng-bind='current_user.cn_name'></span>
				 </small>
			</h1>
		</div>
		
        <div>
           	<p class="remaining"><span ng-bind='month_report.ymonth'></span></p>

			<table class="table">
				<tr ng-repeat='name in show_order'>
					<td ng-bind='name_map[name]'></td>
					<td>
						<span ng-bind='month_report[name].value'></span>
						<span ng-bind='name_map[month_report[name].unit]'></span>
					</td>
				</tr>
			</table>

           	
            <!--<p class='jiezhi'>
	            <span ng-bind='report.start_date'>2015-12-01</span>---<span ng-bind='report.due_date'>2015-12-31</span></p>-->
            <!--<ul class="stat">
                <li class="listat">
                    <span class="col-xs-6">事假</span>
                    <span class="col-xs-6 span2"><span ng-bind='report.personal'></span> days</span>
                </li>
                <li class="listat">
                    <span class="col-xs-6">病假</span>
                    <span class="col-xs-6 span2"><span ng-bind='report.sick'></span> days</span>
                </li>
                <li class="listat">
                    <span class="col-xs-6">带薪假</span>
                    <span class="col-xs-6 span2"><span ng-bind='report.paid'></span> days</span>
                </li>
                <li class="listat">
                    <span class="col-xs-6">迟到(1-15mins)</span>
                    <span class="col-xs-6 span2"><span ng-bind='report.late1'></span> times</span>
                </li>
                <li class="listat">
                    <span class="col-xs-6">迟到(16-60mins)</span>
                    <span class="col-xs-6 span2"><span ng-bind='report.late2'></span> times</span>
                </li>
                <li class="listat">
                    <span class="col-xs-6">迟到(60-120mins)</span>
                    <span class="col-xs-6 span2"><span ng-bind='report.late3'></span> times</span>
                </li>
                <li class="listat">
                    <span class="col-xs-6">迟到(120+mins)</span>
                    <span class="col-xs-6 span2"><span ng-bind='report.late4'></span> times</span>
                </li>
                <li class="listat">
                    <span class="col-xs-6">漏打卡</span>
                    <span class="col-xs-6 span2"><span ng-bind='report.miss'></span> times</span>
                </li>
                <li class="listat">
                    <span class="col-xs-6">旷工</span>
                    <span class="col-xs-6 span2"><span ng-bind='report.absent'></span> days</span>
                </li>

            </ul>-->
        </div>
    </div>
</div>

		<!-----------------弹出框------------------------>
		<div ng-include src='"info_panel.html"'></div>
	</body>
</html>